<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<include file="public:meta" />
	<link href="../public/css/personal/common.css" rel="stylesheet" type="text/css" />
	<link href="../public/css/personal/personal_user.css" rel="stylesheet" type="text/css" />
	<link href="../public/css/personal/personal_ajax_dialog.css" rel="stylesheet" type="text/css" />
	<script src="../public/js/personal/jquery.common.js" type="text/javascript" language="javascript"></script>
	<qscms:load type="category"/>
	<style>
		body {background:#fff;}
</style>
</head>
<body>
	<include file="index_header" />
	<div class="user_main">
		<div class="interest_container">
			<div class="title">您感兴趣的内容有</div>	
			<ul class="items" id="interests">
				<volist name="interests" id="item">
					<li data-id="{$item.id}">{$item.name}</li>
				</volist>
			</ul> 
			<div class="clear"></div>
			<button class="J_hoverbut m_btn" id="confirm_btn" onclick="add()">确　　定</button>
		</div>
		 	
		<div class="clear"></div>
	</div>
	<include file="public/footer" />
	<script type="text/javascript" src="../public/js/jquery.modal.userselectlayer.js"></script>
	<script type="text/javascript" src="../public/js/emailAutoComplete.js"></script>
	<script src="http://static.geetest.com/static/tools/gt.js"></script>
	<script>
		$(function() {
			$("#interests li").click(function() {
				$(this).toggleClass('selected');
			});
			
		});
		
		function add() {
			var items = [];
			$("#confirm_btn").attr("disabled","true");
			$("#confirm_btn").html("提交中...");
			$("#interests li.selected").each(function() {
				items.push({
					id: $(this).attr('data-id'),
					name: $(this).html(),
				});
			});
			
			if(items.length==0) {
				disapperTooltip("remind", "请选择您感兴趣的内容");
				$("#confirm_btn").removeAttr("disabled");
            	$("#confirm_btn").html("确定");
            	return;
			}
			
			$.ajax({
                url: qscms.root+'?m=Home&c=Personal&a=interest',
                type: "post",
                dataType: "json",
                data: {
                    interests: items,
                },
                success: function (result) {
                    if(result.status==1) {
                    	window.location.href=result.data;
                    }else {
                    	$("#confirm_btn").attr("disabled","false");
                    	$("#confirm_btn").html("确定");
                    	disapperTooltip("remind", result.error);
                    }
                }
            });
		}
	</script>
</body>
</html>